<?php
    class WZ_Config
    {        
        public function __construct($name, $vals = array())
        {
            $this->$name = $vals;
        }
        
        public function get($name, $key)
        {
            return $this->$name;
        }
        
        public static function write($key, $value)
        {
            if (null === \WZ::get('WZConfig')) {
                $write = array();
                $write['config'] = array();
                $write['config'][$key] = $value;
            } else {
                $write = \WZ::get('WZConfig');
                if (isset($write['config'][$key])) {
                    unset($write['config'][$key]);
                }
                $write['config'][$key] = $value;
            }
            \WZ::set('WZConfig', $write);
        }
        
        public static function read($key)
        {
            $config = \WZ::get('WZConfig');
            if (isset($config['config'][$key])) {
                return $config['config'][$key];
            }
            return null;
        }
    }